import React, {useState} from 'react';
import {ThemeContext} from "./context";

const Theme = (props) => {

    const [theme, setTheme] = useState('normal');

    return (
        <div>
            <span>主题</span>
            <button onClick={e => setTheme('normal')}>常规</button>
            <button onClick={e => setTheme('night')}>夜间</button>
            <ThemeContext value={theme}>
                {props.children}
            </ThemeContext>
        </div>
    );
};

export default Theme;